<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <h1 id="tip"></h1>
    <img src="./位图/1.jpg" alt="" />
    <img src="./位图/2.jpg" alt="" />
    <img src="./位图/3.jpg" alt="" />
    <img src="./位图/4.jpg" alt="" />
    <script>
      // 注意: window.onresize可以监听到视口的变化
      window.onresize = function () {
        tip.innerText = document.documentElement.clientWidth
      }
    </script>
  </body>
</html>
